package com.lj.web.impl;

import java.util.List;

import com.lj.web.bean.UserInfo;
import com.lj.web.dao.IUserInfoDao;
import com.lj.web.util.BasicSqlSupport;
/*用户操作的实现类*/
public class IUserInfoIMPL extends BasicSqlSupport implements IUserInfoDao{
	public String addUserInfo(UserInfo userInfo) {
		String result="";
		UserInfo ui=new UserInfo();
		if(userInfo!=null){
			List<UserInfo> resultLlist=null;
			if(userInfo.getUserId()==null){
				result="新增用户ID不能为空";
			}
			ui.setUserName(userInfo.getUserName());
			resultLlist=this.session.selectList("com.lj.mybatis.mapper.UserInfo.selectByCond", ui);
			if(resultLlist!=null){
				result="新增用户名不能为空";
			}
			int count=this.session.insert("com.lj.mybatis.mapper.UserInfo.add",userInfo);
			if(count>0){
				result="添加成功";
			}
		}else{
			result="新增用户不能为空";
		}
		return result;
	}

	public List<UserInfo> getUserInfo(UserInfo userInfo) {
		List<UserInfo> resultList=null;
		resultList=this.session.selectList("com.lj.mybatis.mapper.UserInfo.selectByCond", userInfo);
		return resultList;
	}
	public boolean delUserInfo(UserInfo userInfo) {
		this.session.delete("com.lj.mybatis.mapper.UserInfo.delByCond", userInfo);
		return false;
	}

	public boolean updateUserInfo(UserInfo userInfo) {
		// TODO Auto-generated method stub
		return false;
	}
}
